package com.siruier.boss.ui.activity.task

import android.os.Bundle
import android.view.KeyEvent
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.commit
import com.aiyingli.ibxmodule.IBXFragment
import com.aiyingli.ibxmodule.IBXSdk
import com.siruier.boss.R
import com.yanzhenjie.sofia.Utils

class IbxTaskDetailActivity : FragmentActivity() {
    private var mIBXFragment: IBXFragment? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Utils.setStatusBarDarkFont(this, true)
        setContentView(R.layout.activity_fragment)
        IBXSdk.getInstance().initApplication(application)
        mIBXFragment = IBXFragment.getInstance(intent?.extras?.getString("url"))
        supportFragmentManager.commit {
            replace(R.id.frame_layout, mIBXFragment!!)
        }
    }

    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            mIBXFragment?.onKeyDown(keyCode, event)
            return true
        }
        return super.onKeyDown(keyCode, event)
    }
}